import 'package:flutter/material.dart';

class SettingPage extends StatefulWidget {
  const SettingPage({Key? key}) : super(key: key);

  @override
  State<SettingPage> createState() => _SettingPage();
}

class _SettingPage extends State<SettingPage> {
  @override
  Widget build(BuildContext context) {
    const title = 'list';
    return MaterialApp(
      title: title,
      home: Scaffold(
        // appBar: AppBar(
        //   title: Text(title),
        // ),
        body: Center(
          child: ListView(
            //控制方向 默认是垂直的
//           scrollDirection: Axis.horizontal,
            children: <Widget>[
              _getContainer('Maps', Icons.map),
              _getContainer('phone', Icons.phone),
              _getContainer('Maps', Icons.map),
            ],
          ),
        ),
      ),
    );
  }

  /**
   * 抽取item项
   */
  Widget _getContainer(String test, IconData icon) {
    return Container(
      width: 160.0,
//      ListTile
      child: ListTile(
//       显示在title之前
        leading: Icon(icon),
//        显示在title之后
        trailing: Icon(icon),
        title: Text(test),
        subtitle:Text("我是subtitle") ,
      ),
    );
  }
}

